package com.csun.cmny.provider.controller.admin;

import com.csun.cmny.core.support.BaseController;
import com.csun.cmny.provider.model.dto.phone.PhoneEventPageQuery;
import com.csun.cmny.provider.resolver.CmnyMessageSource;
import com.csun.cmny.provider.service.DmcPhoneEventService;
import com.csun.cmny.util.wrapper.WrapMapper;
import com.csun.cmny.util.wrapper.Wrapper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-01-08 17:41
 * @Description:
 */
@RestController
@RequestMapping(value = "/phone", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class DmcPhoneEventController extends BaseController {

    @Resource
    private DmcPhoneEventService dmcPhoneEventService;
    @Resource
    private CmnyMessageSource cmnyMessageSource;

    @ApiOperation(httpMethod = "POST", value = "查询电话机防区事件")
    @RequestMapping(value = "/queryEventListWithPage", method = RequestMethod.POST)
    public Wrapper queryEventListWithPage(@RequestBody PhoneEventPageQuery phoneEventPageQuery) {

        PageInfo pageInfo = dmcPhoneEventService.queryEventListWithPage(phoneEventPageQuery);

       // return WrapMapper.ok(pageInfo);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,cmnyMessageSource.getMessage("operation.success", null),pageInfo);
    }

}
